package jumpingnotes.model.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import net.jf.lucene.analysis.mmseg.MMSegAnalyzer;

import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

@Entity
@Table(name = "member", catalog = "jumping_notes")
@Indexed
@Analyzer(impl = MMSegAnalyzer.class)
public class Member implements java.io.Serializable
{

	private Integer memberId;
	private String nickName;
	private String email;
	private String hashedPassword;
	private String aboutMe;
	private String birthday;
	private Character gender;
	private String locationCity;
	private String locationProvince;
	private String locationCountry;
	private String image;
	private String imageBig;
	private String imageSmall;
	private String imageSquare;
	private String homepage;
	private Integer memberIdInvite;
	private Date accessTime;
	private Date updateTime;
	private Date createTime;
	private Date lastLoginTime;
	private Set<Friend> friendsForMemberIdTo = new HashSet<Friend>(0);
	private Set<GroupMember> groupMembers = new HashSet<GroupMember>(0);
	private Set<BookFavorite> bookFavorites = new HashSet<BookFavorite>(0);
	private Set<FriendConfirm> friendConfirmsForMemberIdTo = new HashSet<FriendConfirm>(0);
	private Set<Activity> activities = new HashSet<Activity>(0);
	private Set<Group> groups = new HashSet<Group>(0);
	private Set<RecordAlbum> recordAlbums = new HashSet<RecordAlbum>(0);
	private Set<BookComment> bookComments = new HashSet<BookComment>(0);
	private Set<Friend> friendsForMemberIdFrom = new HashSet<Friend>(0);
	private Set<GroupMemberConfirm> groupMemberConfirms = new HashSet<GroupMemberConfirm>(0);
	private Set<Message> messagesForMemberIdTo = new HashSet<Message>(0);
	private Set<MemberExperience> memberExperiences = new HashSet<MemberExperience>(0);
	private Set<FriendConfirm> friendConfirmsForMemberIdFrom = new HashSet<FriendConfirm>(0);
	private Set<GroupTopic> groupTopics = new HashSet<GroupTopic>(0);
	private Set<GroupTopicComment> groupTopicComments = new HashSet<GroupTopicComment>(0);
	private Set<Message> messagesForMemberIdFrom = new HashSet<Message>(0);
	private Set<GroupAdmin> groupAdmins = new HashSet<GroupAdmin>(0);

	public Member()
	{
	}

	public Member(String nickName, String email, String hashedPassword, Date accessTime, Date updateTime,
			Date createTime)
	{
		this.nickName = nickName;
		this.email = email;
		this.hashedPassword = hashedPassword;
		this.accessTime = accessTime;
		this.updateTime = updateTime;
		this.createTime = createTime;
	}

	public Member(String nickName, String email, String hashedPassword, String aboutMe, String birthday,
			Character gender, String locationCity, String locationProvince, String locationCountry, String image,
			String imageBig, String imageSmall, String imageSquare, String homepage, Integer memberIdInvite,
			Date accessTime, Date updateTime, Date createTime, Date lastLoginTime, Set<Friend> friendsForMemberIdTo,
			Set<GroupMember> groupMembers, Set<BookFavorite> bookFavorites,
			Set<FriendConfirm> friendConfirmsForMemberIdTo, Set<Activity> activities, Set<Group> groups,
			Set<RecordAlbum> recordAlbums, Set<BookComment> bookComments, Set<Friend> friendsForMemberIdFrom,
			Set<GroupMemberConfirm> groupMemberConfirms, Set<Message> messagesForMemberIdTo,
			Set<MemberExperience> memberExperiences, Set<FriendConfirm> friendConfirmsForMemberIdFrom,
			Set<GroupTopic> groupTopics, Set<GroupTopicComment> groupTopicComments,
			Set<Message> messagesForMemberIdFrom, Set<GroupAdmin> groupAdmins)
	{
		this.nickName = nickName;
		this.email = email;
		this.hashedPassword = hashedPassword;
		this.aboutMe = aboutMe;
		this.birthday = birthday;
		this.gender = gender;
		this.locationCity = locationCity;
		this.locationProvince = locationProvince;
		this.locationCountry = locationCountry;
		this.image = image;
		this.imageBig = imageBig;
		this.imageSmall = imageSmall;
		this.imageSquare = imageSquare;
		this.homepage = homepage;
		this.memberIdInvite = memberIdInvite;
		this.accessTime = accessTime;
		this.updateTime = updateTime;
		this.createTime = createTime;
		this.lastLoginTime = lastLoginTime;
		this.friendsForMemberIdTo = friendsForMemberIdTo;
		this.groupMembers = groupMembers;
		this.bookFavorites = bookFavorites;
		this.friendConfirmsForMemberIdTo = friendConfirmsForMemberIdTo;
		this.activities = activities;
		this.groups = groups;
		this.recordAlbums = recordAlbums;
		this.bookComments = bookComments;
		this.friendsForMemberIdFrom = friendsForMemberIdFrom;
		this.groupMemberConfirms = groupMemberConfirms;
		this.messagesForMemberIdTo = messagesForMemberIdTo;
		this.memberExperiences = memberExperiences;
		this.friendConfirmsForMemberIdFrom = friendConfirmsForMemberIdFrom;
		this.groupTopics = groupTopics;
		this.groupTopicComments = groupTopicComments;
		this.messagesForMemberIdFrom = messagesForMemberIdFrom;
		this.groupAdmins = groupAdmins;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "member_id", unique = true, nullable = false)
	@DocumentId
	public Integer getMemberId()
	{
		return this.memberId;
	}

	public void setMemberId(Integer memberId)
	{
		this.memberId = memberId;
	}

	@Column(name = "nick_name", nullable = false)
	@Field(index = Index.TOKENIZED, store = Store.NO)
	public String getNickName()
	{
		return this.nickName;
	}

	public void setNickName(String nickName)
	{
		this.nickName = nickName;
	}

	@Column(name = "email", nullable = false, length = 100)
	public String getEmail()
	{
		return this.email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	@Column(name = "hashed_password", nullable = false, length = 65535)
	public String getHashedPassword()
	{
		return this.hashedPassword;
	}

	public void setHashedPassword(String hashedPassword)
	{
		this.hashedPassword = hashedPassword;
	}

	@Column(name = "about_me", length = 65535)
	@Field(index = Index.TOKENIZED, store = Store.NO)
	public String getAboutMe()
	{
		return this.aboutMe;
	}

	public void setAboutMe(String aboutMe)
	{
		this.aboutMe = aboutMe;
	}

	@Column(name = "birthday", length = 20)
	public String getBirthday()
	{
		return this.birthday;
	}

	public void setBirthday(String birthday)
	{
		this.birthday = birthday;
	}

	@Column(name = "gender", length = 1)
	public Character getGender()
	{
		return this.gender;
	}

	public void setGender(Character gender)
	{
		this.gender = gender;
	}

	@Column(name = "location_city", length = 20)
	@Field(index = Index.TOKENIZED, store = Store.NO)
	public String getLocationCity()
	{
		return this.locationCity;
	}

	public void setLocationCity(String locationCity)
	{
		this.locationCity = locationCity;
	}

	@Column(name = "location_province", length = 20)
	@Field(index = Index.TOKENIZED, store = Store.NO)
	public String getLocationProvince()
	{
		return this.locationProvince;
	}

	public void setLocationProvince(String locationProvince)
	{
		this.locationProvince = locationProvince;
	}

	@Column(name = "location_country", length = 20)
	@Field(index = Index.TOKENIZED, store = Store.NO)
	public String getLocationCountry()
	{
		return this.locationCountry;
	}

	public void setLocationCountry(String locationCountry)
	{
		this.locationCountry = locationCountry;
	}

	@Column(name = "image")
	public String getImage()
	{
		return this.image;
	}

	public void setImage(String image)
	{
		this.image = image;
	}

	@Column(name = "image_big")
	public String getImageBig()
	{
		return this.imageBig;
	}

	public void setImageBig(String imageBig)
	{
		this.imageBig = imageBig;
	}

	@Column(name = "image_small")
	public String getImageSmall()
	{
		return this.imageSmall;
	}

	public void setImageSmall(String imageSmall)
	{
		this.imageSmall = imageSmall;
	}

	@Column(name = "image_square")
	public String getImageSquare()
	{
		return this.imageSquare;
	}

	public void setImageSquare(String imageSquare)
	{
		this.imageSquare = imageSquare;
	}

	@Column(name = "homepage", length = 100)
	public String getHomepage()
	{
		return this.homepage;
	}

	public void setHomepage(String homepage)
	{
		this.homepage = homepage;
	}

	@Column(name = "member_id_invite")
	public Integer getMemberIdInvite()
	{
		return this.memberIdInvite;
	}

	public void setMemberIdInvite(Integer memberIdInvite)
	{
		this.memberIdInvite = memberIdInvite;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "access_time", nullable = false, length = 19)
	public Date getAccessTime()
	{
		return this.accessTime;
	}

	public void setAccessTime(Date accessTime)
	{
		this.accessTime = accessTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", nullable = false, length = 19)
	public Date getUpdateTime()
	{
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 19)
	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_login_time", length = 19)
	public Date getLastLoginTime()
	{
		return this.lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime)
	{
		this.lastLoginTime = lastLoginTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdTo")
	public Set<Friend> getFriendsForMemberIdTo()
	{
		return this.friendsForMemberIdTo;
	}

	public void setFriendsForMemberIdTo(Set<Friend> friendsForMemberIdTo)
	{
		this.friendsForMemberIdTo = friendsForMemberIdTo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<GroupMember> getGroupMembers()
	{
		return this.groupMembers;
	}

	public void setGroupMembers(Set<GroupMember> groupMembers)
	{
		this.groupMembers = groupMembers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<BookFavorite> getBookFavorites()
	{
		return this.bookFavorites;
	}

	public void setBookFavorites(Set<BookFavorite> bookFavorites)
	{
		this.bookFavorites = bookFavorites;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdTo")
	public Set<FriendConfirm> getFriendConfirmsForMemberIdTo()
	{
		return this.friendConfirmsForMemberIdTo;
	}

	public void setFriendConfirmsForMemberIdTo(Set<FriendConfirm> friendConfirmsForMemberIdTo)
	{
		this.friendConfirmsForMemberIdTo = friendConfirmsForMemberIdTo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<Activity> getActivities()
	{
		return this.activities;
	}

	public void setActivities(Set<Activity> activities)
	{
		this.activities = activities;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<Group> getGroups()
	{
		return this.groups;
	}

	public void setGroups(Set<Group> groups)
	{
		this.groups = groups;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<RecordAlbum> getRecordAlbums()
	{
		return this.recordAlbums;
	}

	public void setRecordAlbums(Set<RecordAlbum> recordAlbums)
	{
		this.recordAlbums = recordAlbums;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<BookComment> getBookComments()
	{
		return this.bookComments;
	}

	public void setBookComments(Set<BookComment> bookComments)
	{
		this.bookComments = bookComments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdFrom")
	public Set<Friend> getFriendsForMemberIdFrom()
	{
		return this.friendsForMemberIdFrom;
	}

	public void setFriendsForMemberIdFrom(Set<Friend> friendsForMemberIdFrom)
	{
		this.friendsForMemberIdFrom = friendsForMemberIdFrom;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<GroupMemberConfirm> getGroupMemberConfirms()
	{
		return this.groupMemberConfirms;
	}

	public void setGroupMemberConfirms(Set<GroupMemberConfirm> groupMemberConfirms)
	{
		this.groupMemberConfirms = groupMemberConfirms;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdTo")
	public Set<Message> getMessagesForMemberIdTo()
	{
		return this.messagesForMemberIdTo;
	}

	public void setMessagesForMemberIdTo(Set<Message> messagesForMemberIdTo)
	{
		this.messagesForMemberIdTo = messagesForMemberIdTo;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<MemberExperience> getMemberExperiences()
	{
		return this.memberExperiences;
	}

	public void setMemberExperiences(Set<MemberExperience> memberExperiences)
	{
		this.memberExperiences = memberExperiences;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdFrom")
	public Set<FriendConfirm> getFriendConfirmsForMemberIdFrom()
	{
		return this.friendConfirmsForMemberIdFrom;
	}

	public void setFriendConfirmsForMemberIdFrom(Set<FriendConfirm> friendConfirmsForMemberIdFrom)
	{
		this.friendConfirmsForMemberIdFrom = friendConfirmsForMemberIdFrom;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<GroupTopic> getGroupTopics()
	{
		return this.groupTopics;
	}

	public void setGroupTopics(Set<GroupTopic> groupTopics)
	{
		this.groupTopics = groupTopics;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<GroupTopicComment> getGroupTopicComments()
	{
		return this.groupTopicComments;
	}

	public void setGroupTopicComments(Set<GroupTopicComment> groupTopicComments)
	{
		this.groupTopicComments = groupTopicComments;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "memberByMemberIdFrom")
	public Set<Message> getMessagesForMemberIdFrom()
	{
		return this.messagesForMemberIdFrom;
	}

	public void setMessagesForMemberIdFrom(Set<Message> messagesForMemberIdFrom)
	{
		this.messagesForMemberIdFrom = messagesForMemberIdFrom;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "member")
	public Set<GroupAdmin> getGroupAdmins()
	{
		return this.groupAdmins;
	}

	public void setGroupAdmins(Set<GroupAdmin> groupAdmins)
	{
		this.groupAdmins = groupAdmins;
	}

}
